package com.googlecode.afx.view.validation;

import java.util.ArrayList;
import java.util.List;

import javafx.scene.Node;

/**
 * Validation exception class that carries one or more <code>ValidationItem</code>s.
 * 
 * @author MartinKoster
 *
 */
public class ValidationException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private List<ValidationItem> validationItems = new ArrayList<ValidationItem>();
	
	public ValidationException(List<ValidationItem> items) {
		this.validationItems.addAll(items);
	}
	
	public ValidationException(ValidationItem item) {
		this.validationItems.add(item);
	}
	
	public ValidationException(String message, Node affectedNode) {
		this(new ValidationItem(message, affectedNode));
	}

	public ValidationException(String message) {
		this(message, null);
	}	

	public List<ValidationItem> getValidationItems() {
		return validationItems;
	}

	public void setValidationItems(List<ValidationItem> validationItems) {
		this.validationItems = validationItems;
	}
	
}
